var e = getApp();

Component({
    properties: {
        datas: {
            type: null
        },
        store_id: {
            type: null
        }
    },
    data: {
        language: ""
    },
    lifetimes: {
        attached: function() {
            var e = wx.getStorageSync("langIndex");
            this.setData({
                language: e.en
            }), this.getBalance();
        }
    },
    methods: {
        toStoreBalance: function(e) {
            "balance" == e.currentTarget.dataset.key ? wx.navigateTo({
                url: "/packageI/independenceBalance/storeBalance/balance_recharge?store_id=" + this.data.store_id
            }) : wx.navigateTo({
                url: "/packageI/independenceBalance/independenceBalance?store_id=" + this.data.store_id
            });
        },
        getBalance: function() {
            var a = this, t = e.getNetAddresss("plugin.store-cashier.frontend.store.balance.setting.index");
            e._postNetWork({
                url: t,
                data: {
                    store_id: this.data.store_id
                },
                success: function(e) {
                    console.log(e);
                    var t = e.data;
                    a.setData({
                        is_open: t.data.is_open,
                        balanceTitle: t.data.title,
                        member_balance: t.data.member_balance,
                        show_button: t.data.show_button
                    });
                },
                fail: function(e) {
                    wx.showToast({
                        title: e.data.msg,
                        duration: 1e3,
                        icon: "none"
                    });
                }
            });
        }
    }
});